#!/usr/bin/env bash

public::common::install_font() {
	local workspace=$(pwd)
	git clone https://gitee.com/bearxup/nerd-fonts.git ~/nerd-fonts
	cd ~/nerd-fonts
	bash -c ./install.sh
	cd ${workspace}
}

public::zsh::plugin() {
	git clone https://gitee.com/malzahar/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
	git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
}

public::zsh::config() {
	sed -i 's#ZSH_THEME="robbyrussell"#ZSH_THEME="powerlevel10k/powerlevel10k"#' ~/.zshrc
	sed -i 's#plugins=(git)#plugins=(git zsh-autosuggestions)#' ~/.zshrc
	sed -i '/zsh-autosuggestions/aZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"' ~/.zshrc
	echo "export GOPROXY=https://goproxy.cn" >> ~/.zshrc
	echo "export GOPRIVATE=*.nenly.cn" >> ~/.zshrc
}

main() {
	public::common::install_font
	public::zsh::plugin
	public::zsh::config
}

main
